<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>示例5</title>
    <style>
        #one{
            border: 3px solid black;
            width: 60px;
            height: 60px;
        }
    </style>
    <script src="jquery.js"></script>
    <script>
        $(function (){
            $("#username").focus(function (){
                $("#one").css("background-color","blue");
            }).blur(function (){
                $("#one").css("background-color","white");
            }).change(function (){
                //失去焦点后触发
                console.log(this.value)
            })

            $("form").submit(function (){
                alert('提交成功')
                return false;
            })
        })
    </script>
</head>
<body>
    <div id="one"></div>
    <form action="">
        <input id="username"/>
        <button>提交</button>
    </form>
</body>
</html>